package com.cnswhy.cloud.server.app.config;

import com.cnswhy.cloud.server.app.filter.LoginInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

public class CnswhyAppInteceptorConfigure implements WebMvcConfigurer {
    @Autowired
    LoginInterceptor loginInterceptor;
    /*@Bean
    private LoginInterceptor loginInterceptor(){
        return new LoginInterceptor();
    }*/
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(loginInterceptor).addPathPatterns("/**")
        .excludePathPatterns("/main/**")
        .excludePathPatterns("/aliPayNotify/**")
        .excludePathPatterns("/HcPayNotify/**")
        .excludePathPatterns("/sandePayNotify/**")
        .excludePathPatterns("/wxNotify/**")
        .excludePathPatterns("/swagger-resources/**")
        .excludePathPatterns("/spellPrice/**")
        .excludePathPatterns("/trade/queryPage")
        .excludePathPatterns("/spell/ajaxSuccessSpell")
        .excludePathPatterns("/shop/comment/**")
        .excludePathPatterns("/shop/product/**")
        .excludePathPatterns("/cps/notify/**")
        .excludePathPatterns("/merch/**")
        .excludePathPatterns("/shop/order/orderQuery")
                //框架不屏蔽的接口
        .excludePathPatterns("/doc.html")
        .excludePathPatterns("/v2/**")
        .excludePathPatterns("/test/**")
        .excludePathPatterns("/swagger-ui.html")
        .excludePathPatterns("/configuration/ui")
        .excludePathPatterns("/swagger-resources")
        .excludePathPatterns("/configuration/security")
        .excludePathPatterns("/v2/api-docs")
        .excludePathPatterns("/error")
        .excludePathPatterns("/favicon.ico")
        .excludePathPatterns("/webjars/**")
        .excludePathPatterns("/**/favicon.ico");
    }

}
